package com.tsu.mall.order.Controller;

import com.tsu.mall.common.util.RequestUtil;
import com.tsu.mall.order.service.ICartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
public class IndexController {
    @Autowired
    private ICartService iCartService;
    @GetMapping("/index")
    public String index(Model model) {
        //查询购物车中商品数量
        Integer cartWaresNumber=iCartService.selectCartWaresNumberById(RequestUtil.getCurrent().getId());
        model.addAttribute("cartWaresNumber",cartWaresNumber);
        return "index";
    }
}
